import React, { memo } from 'react'
import type { FC, ReactNode } from 'react'

interface Iprops {
  name?: string
  children?: ReactNode
}

const Demo: FC<Iprops> = (props) => {
  return (
    <div>
      <h1>Demo</h1>
      <div>{props.name}</div>
    </div>
  )
}

//1. 直接对props进行类型约束
// const Discover = (props: Iprops) => {
//   return (
//     <div>
//       <h1>Discover</h1>
//       <div>{props.name}</div>
//     </div>
//   )
// }

export default memo(Demo)
